using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System.IO;
using System.Diagnostics;

namespace amazingfishing
{
    public class Button
    {
        protected Texture2D img;
        protected Vector2 position;
        protected int width;
        protected int height;
        protected Rectangle rec;
        public delegate void todoDelegate();
        public event todoDelegate todoEvent;

        public Button(){}

        public Button(Texture2D _img, Vector2 _position)
        {
            img = _img;
            
            position = _position;
            width = img.Width;
            height = img.Height;
        }

        public void setImage(Texture2D _img)
        {
            img = _img;
        }

        public void setPosition(Vector2 _position)
        {
            position = _position;
        }

        public void resize(int w, int h)
        {
            width = w;
            height = h;
        }

        public void checkClick(Vector2 clickPos)
        {
                if (clickPos.X > rec.X && clickPos.X < rec.X+rec.Width && clickPos.Y > rec.Y && clickPos.Y < rec.Y+rec.Height)
                {
                    todoEvent();
                }
        }

        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            rec = new Rectangle((int)position.X, (int)position.Y, width, height);
            spriteBatch.Draw(img, rec,Color.White);
        }

        //USED
        public void Update(GameTime gameTime)
        {
            //checkClick();
        }

    }
}
